#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const ll inf=1e18;
const int N=160099,M=320099;
int n,m;
ll a,b;
struct edge{
    int v,nxt;
}edg[M*2];
int cntedge,hd[N];
void add(int u,int v){
    cntedge++;
    edg[cntedge]=(edge){v,hd[u]};
    hd[u]=cntedge;
}
int dis[N][2];
namespace fake{
    void bfs(){
        memset(dis,0x3f,sizeof(dis));
        queue<pair<int,int>> que;
        que.push(make_pair(1,0));
        dis[1][0]=0;
        int u,c,v; pair<int,int> now;
        while(!que.empty()){
            now=que.front(); que.pop();
            u=now.first; c=now.second;
            for(int i=hd[u];i;i=edg[i].nxt){
                v=edg[i].v;
                if(dis[v][c^1]<=dis[u][c]+1) continue;
                dis[v][c^1]=dis[u][c]+1;
                que.push(make_pair(v,c^1));
            }
        }
        return;
    }
    void solve(){
        bfs();
        ll ans;
        for(int i=2;i<=n;i++){
            ans=inf;
            if(dis[i][0]!=dis[0][0]) ans=min(ans,min(dis[i][0]*a,dis[i][0]/2*b));
            if(dis[i][1]!=dis[0][0]) ans=min(ans,min(dis[i][1]*a,a+dis[i][1]/2*b));
            cout<<ans<<'\n';
        }
    }
}
int p[N],deg[N],vis[N];
int cnt[N],in[N],dist[N],nd[5];
bool cmp(int A,int B){
    return deg[A]>deg[B];
}
bool cmpp(int A,int B){
    return dis[A][0]<dis[B][0]||(dis[A][0]==dis[B][0]&&A<B);
}
map<pair<int,int>,int> mp;
namespace real{
    void bfs1(){
        memset(dis,0x3f,sizeof(dis));
        queue<int> que;
        que.push(1);
        dis[1][0]=0;
        int u,v;
        while(!que.empty()){
            u=que.front(); que.pop();
            for(int i=hd[u];i;i=edg[i].nxt){
                v=edg[i].v;
                if(dis[v][0]<=dis[u][0]+1) continue;
                dis[v][0]=dis[u][0]+1;
                que.push(v);
            }
        }
        return;
    }
    void findcycle(){
        int u,v,w;
        for(int i=1;i<=n;i++) p[i]=i;
        sort(p+1,p+n+1,cmp);
        for(int i=1;i<=n;i++){
            u=p[i]; vis[u]=1;
            for(int j=hd[u];j;j=edg[j].nxt){
                v=edg[j].v,in[v]=1;
                if(dis[v][0]<dis[u][0])
                    cnt[u]++;
            }
            for(int j=hd[u];j;j=edg[j].nxt){
                v=edg[j].v;
                if(vis[v]) continue;
                for(int k=hd[v];k;k=edg[k].nxt){
                    w=edg[k].v;
                    if(vis[w]||!in[w]) continue;
                    nd[1]=u; nd[2]=v; nd[3]=w;
                    sort(nd+1,nd+3+1,cmpp);
                    if(dis[nd[1]][0]==dis[nd[3]][0]) continue;
                    mp[make_pair(nd[2],nd[3])]++;
                }
            }
            for(int j=hd[u];j;j=edg[j].nxt)
                v=edg[j].v,in[v]=0;
        }
        pair<int,int> now;
        for(u=1;u<=n;u++){
            for(int i=hd[u];i;i=edg[i].nxt){
                v=edg[i].v; if(v<u) continue;
                now=make_pair(u,v);
                if(dis[u][0]==dis[v][0]){
                    if(cnt[u]>mp[now]) in[v]=1;
                    if(cnt[v]>mp[now]) in[u]=1;
                }
            }
        }
    }
    void bfs(){
        for(int i=1;i<=n;i++) dist[i]=dis[i][0];
        memset(dis,0x3f,sizeof(dis));
        queue<pair<int,int>> que;
        que.push(make_pair(1,0));
        dis[1][0]=0;
        int u,c,v; pair<int,int> now;
        while(!que.empty()){
            now=que.front(); que.pop();
            u=now.first; c=now.second;
            if(in[u]&&dis[u][c^1]>dis[u][c]+1){
                dis[u][c^1]=dis[u][c]+1;
                que.push(make_pair(u,c^1));
            }
            for(int i=hd[u];i;i=edg[i].nxt){
                v=edg[i].v;
                if(dis[v][c^1]<=dis[u][c]+1||dist[u]==dist[v]) continue;
                dis[v][c^1]=dis[u][c]+1;
                que.push(make_pair(v,c^1));
            }
        }
        return;
    }
    void solve(){
        bfs1();
        findcycle();
        bfs();
        ll ans;
        for(int i=2;i<=n;i++){
            ans=inf;
            if(dis[i][0]!=dis[0][0]) ans=min(ans,dis[i][0]/2*b);
            if(dis[i][1]!=dis[0][0]) ans=min(ans,a+dis[i][1]/2*b);
            cout<<ans<<'\n';
        }
    }
}
int main(){
    freopen("edge.in","r",stdin);
    freopen("edge.out","w",stdout);
    std::ios::sync_with_stdio(false);
    cin.tie(0);
    cin>>n>>m>>a>>b;
    int u,v;
    for(int i=1;i<=m;i++){
        cin>>u>>v;
        add(u,v); add(v,u);
        deg[u]++; deg[v]++;
    }
    if(a<=b) fake::solve();
    else real::solve();
//    cerr<<fixed<<setprecision(3)<<(double)clock()/CLOCKS_PER_SEC;
    return 0;
}